export interface BaseMessage {
  id: string;
  username: string;
  userId: string;
  dateTime: string;
  timestamp: Date;
  randomColor: string;
}

export interface TextMessage extends BaseMessage {
  type: 'text';
  message: string;
}

export interface FileMessage extends BaseMessage {
  type: 'file';
  message: string; // 文件消息的描述文本
  fileName: string;
  fileSize: number;
  filePath?: string; // 文件路径，上传完成后才有
  fileHash: string;
  fileType?: string; // 文件类型
  uploadProgress?: number; // 上传进度 0-100
  isLocalUpload?: boolean; // 标记是否为本地上传消息
}

export type Message = TextMessage | FileMessage;

export interface FileUploadStatus {
  fileName: string;
  fileSize: number;
  progress: number;
  status: 'uploading' | 'completed' | 'error';
  fileHash: string;
}

export interface MessageState {
  messages: Message[];
  uploadingFiles: Map<string, FileUploadStatus>;
}